home *** CD-ROM | disk | FTP | other *** search
/ GameStar 1998 November (Bonus) / GAMESTAR11B.ISO / ENCYC99 / MM / T620273A.DCR / scripts_43_Class ScrollButtonGod.ls < prev    next >
Encoding:
Text File  |  1998-07-02  |  1.8 KB  |  95 lines

  1. property UpButton, DownButton, scrollState, grabberClicked, overButton
  2.  
  3. on catchEvent me, xEvent
  4.   case xEvent of
  5.     #top:
  6.       if scrollState <> #top then
  7.         set scrollState to #top
  8.         updateButtons(me)
  9.       end if
  10.     #middle:
  11.       if scrollState <> #middle then
  12.         set scrollState to #middle
  13.         updateButtons(me)
  14.       end if
  15.     #bottom:
  16.       if scrollState <> #bottom then
  17.         set scrollState to #bottom
  18.         updateButtons(me)
  19.       end if
  20.     #grabberClicked:
  21.       if not grabberClicked then
  22.         set grabberClicked to 1
  23.         updateButtons(me)
  24.       end if
  25.     #grabberReleased:
  26.       if grabberClicked then
  27.         set grabberClicked to 0
  28.         updateButtons(me)
  29.       end if
  30.     #overUp, #overDown, #overNone:
  31.       set overButton to xEvent
  32.       updateButtons(me)
  33.   end case
  34. end
  35.  
  36. on turnON me
  37.   updateButtons(me)
  38. end
  39.  
  40. on turnOff me
  41.   turnOff(UpButton)
  42.   turnOff(DownButton)
  43. end
  44.  
  45. on new me
  46.   set grabberClicked to 0
  47.   return me
  48. end
  49.  
  50. on linkUp me, xUpButton, xDownButton
  51.   set UpButton to xUpButton
  52.   set DownButton to xDownButton
  53.   turnOff(me)
  54. end
  55.  
  56. on updateButtons me
  57.   if grabberClicked then
  58.     turnOff(UpButton)
  59.     turnOff(DownButton)
  60.   else
  61.     case overButton of
  62.       #overUp:
  63.         turnOff(DownButton)
  64.         if scrollState <> #top then
  65.           turnON(UpButton)
  66.         else
  67.           turnOff(UpButton)
  68.         end if
  69.       #overDown:
  70.         turnOff(UpButton)
  71.         if scrollState <> #bottom then
  72.           turnON(DownButton)
  73.         else
  74.           turnOff(DownButton)
  75.         end if
  76.       otherwise:
  77.         normalButtons(me)
  78.     end case
  79.   end if
  80. end
  81.  
  82. on normalButtons me
  83.   case scrollState of
  84.     #top:
  85.       turnOff(UpButton)
  86.       turnON(DownButton)
  87.     #middle:
  88.       turnON(UpButton)
  89.       turnON(DownButton)
  90.     #bottom:
  91.       turnON(UpButton)
  92.       turnOff(DownButton)
  93.   end case
  94. end
  95.